import Mock from "mockjs";
const Random = Mock.Random;
export default [
  {
    url: "/login",
    type: "get",
    response: () => {
      return {
        code: 200,
        message: "登陆成功",
        data: {
          name: Random.string(4),
          token:Random.string(32)
        },
      };
    },
  },
  // goods list
  {
    url: "/goods/list",
    type: "get",
    response: () => {
      return {
        code: 200,
        message: "获取成功",
        data: [{
          id:1,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },
        {
          id:2,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:3,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:4,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:5,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:6,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:7,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:8,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:9,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:10,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:11,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:12,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:13,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:14,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:15,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:16,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:17,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:18,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        },{
          id:19,
          title: Random.string(4),
          goodsNumber:Mock.mock({ "number|1-100": 100}),
          goodsCover:Random.image('200x100', '#50B347', '#FFF', Random.string(4))
        }],
      };
    },
  },
  {
    url: "/user/list",
    type: "get",
    response: () => {
      return {
        code: 200,
        message: "获取成功",
        data: [
          { id:1,nickName:"111", role:[{role:1,roleName:"超级管理员"},{role:2,roleName:"管理员"}] },
          { id:2,nickName:"222", role:[{role:2,roleName:"管理员"},{role:2,roleName:"普通用户"}] },
          { id:3,nickName:"333", role:[{role:3,roleName:"普通用户"}] },
          { id:4,nickName:"444", role:[{role:3,roleName:"普通用户"}] },
          { id:5,nickName:"555", role:[{role:3,roleName:"普通用户"}] },
          { id:6,nickName:"666", role:[{role:3,roleName:"普通用户"}] },
          { id:7,nickName:"777", role:[{role:3,roleName:"普通用户"}] },
          { id:8,nickName:"888", role:[{role:3,roleName:"普通用户"}] },
          { id:9,nickName:"999", role:[{role:3,roleName:"普通用户"}] },
        ],
      };
    },
  },
  {
    url: "/role/list",
    type: "get",
    response: () => {
      return {
        code: 200,
        message: "获取成功",
        data: [
          {
            roleName:"超级管理员",
            roleId:1,
            authority:[2,3,4,11,12,21,22,31,32]
          },
          {
            roleName:"管理员",
            roleId:2,
            authority:[2,3,4,11,21,31]
          },
          {
            roleName:"普通用户",
            roleId:3,
            authority:[11,22]
          }
        ],
      };
    },
  },

  {
    url: "/auth/list",
    type: "get",
    response: () => {
      return {
        code: 200,
        message: "获取成功",
        data: [
          {
            roelId:1,
            name:"订单详情",
            roleList:[
              { name:"订单详情", roleId:4,},
              { name:"查看", roleId:2,},
              { name:"删除", roleId:3,},
            ]
          },
          
          {
            roelId:10,
            name:"角色管理",
            roleList:[
              { name:"查看", roleId:11,},
              { name:"删除", roleId:12,},
            ]
          },

          {
            roelId:20,
            name:"用户列表",
            roleList:[
              { name:"查看", roleId:21,},
              { name:"删除", roleId:22,},
            ]
          },

          {
            roelId:30,
            name:"用户列表",
            roleList:[
              { name:"查看", roleId:31,},
              { name:"删除", roleId:22,},
            ]
          },

        ]
      };
    },
  },




  // GetToken
  {
    url: "/auth/oauth/token",
    type: "post",
    response: (option: any) => {
      const $name = JSON.parse(option.body).name;
      if ($name) {
        return Mock.mock({
          code: 200,
          message: "成功",
          data: {
            name: "testToken",
          },
        });
      } else {
        return Mock.mock({
          code: 400,
          message: "未提交参数",
        });
      }
    },
  },
];
